import java.util.*;
import java.net.*;
import java.io.*;
import java.awt.image.*;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.imageio.ImageIO;
import javax.swing.JPanel;
import javax.swing.JFrame;
import java.awt.*;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;

public class Test {
    private static KeyAdapter avatarEscaper = new KeyAdapter() {  
        @Override
        public void keyPressed(KeyEvent e) {
    
                
               if (e.getKeyCode() == KeyEvent.VK_ESCAPE) {
                  System.out.println("Weee");
                   
                }
        }
            };
    public static void main(String[] args) {
        try {
            File file = new File("C:/Users/Dark_Wolf/Desktop/AlbumArt_{87382248-614B-46B6-8E62-3963FDF8C74D}_Large.jpg");
            URI u = new URI("C:/Users/Dark_Wolf/Desktop/AlbumArt_{87382248-614B-46B6-8E62-3963FDF8C74D}_Large.jpg");
            System.out.println(file.exists());
            Avatar av = new FileAvatar(file, u, "Ayla", "Nirwana", true, new CDShelf());

            JFrame frame = new JFrame();
            frame.addKeyListener(avatarEscaper);
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            frame.setLayout(new StackLayout());

            frame.add(new ImagePanel(av.getRawImage(), 600, 600));

            frame.pack();
            frame.setVisible(true);
            AvatarPanel avPanel = new AvatarPanel(av, frame);
            frame.add(avPanel);
            frame.pack();
            avPanel.fadeIn();
        } catch (URISyntaxException ex) {
            Logger.getLogger(Test.class.getName()).log(Level.SEVERE, null, ex);
        }
        
        
    }
    private class AvatarEscaper extends KeyAdapter {
        @Override
        public void keyPressed(KeyEvent e) {
                
               if (e.getKeyCode() == KeyEvent.VK_ESCAPE) {
                  System.out.println("Weee");
                   
                }
            }
        }
}